<template>
<div>
  <div class="header" style="height: 46px;
    overflow: hidden;position: absolute;
    width: 100%;
    z-index: 1;
    top: 0;
    background: #fff;
    line-height: 46px;
    border-bottom: 1px solid #f2f2f2;">
      <div class="icon" style="position: fixed; left:16px; font-size:14px; color:#1989fa;" @click="reTurn">
        <van-icon name="arrow-left"></van-icon>
      </div>
      <p style="margin: 0; padding: 0;">编辑收货地址</p>
  </div>
  <div style="position: relative;top: 46px;">
    <van-notice-bar mode="closeable">
      目前只配送同城快递，超出本市暂不配送。
    </van-notice-bar>
  </div>
      <van-address-edit
        :area-list="areaList"
        show-delete
        show-set-default
        show-search-result
        :search-result="searchResult"
        @save="onSave"
        @delete="onDelete"
        @change-detail="onChangeDetail"
        style="text-align: -webkit-left; position: relative; top: 46px;"></van-address-edit>
</div>
</template>

<script>
import areaList from '../../area/demo/area'
export default {
  name: 'addAddress',
  i18n: {
    'zh-CN': {
      searchResult: [{
        name: '黄龙万科中心',
        address: '杭州市西湖区'
      }, {
        name: '黄龙万科中心G座'
      }, {
        name: '黄龙万科中心H座',
        address: '杭州市西湖区'
      }]
    },
    'en-US': {
      searchResult: [{
        name: 'Name1',
        address: 'Address'
      }, {
        name: 'Name2'
      }, {
        name: 'Name3',
        address: 'Address'
      }]
    }
  },
  data () {
    return {
      areaList,
      searchResult: []
    }
  },
  methods: {
    onSave () {
      alert('保存成功')
    },
    onDelete () {
      alert('删除成功')
    },
    onChangeDetail (val) {
      this.searchResult = val ? this.$t('searchResult') : []
    },
    reTurn () {
      this.$router.go(-1)
    }
  }
}
</script>
<style scoped>
</style>
